package com.lmt.ymcc.feignclient;

import com.lmt.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Description: TODO
 * @Author: Amazing
 * @Date: 2022/8/14 15:10
 * @Version: 1.0
 */
@Component
public class MediaFeignFallbackFactory implements FallbackFactory<MediaFeignClient> {

    @Override
    public MediaFeignClient create(Throwable throwable) {
        return courseId -> {
            throwable.printStackTrace();
            return JSONResult.error("系统错误，返回兜底数据");
        };
    }
}